package com.bang.concurrency.example.immutable;

import com.bang.concurrency.annotations.NotThreadSafe;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;

import java.util.Collections;
import java.util.Map;

/**
 * @Auther: Bang
 * @Date: 2019/9/30 22:32
 * @Description:
 */
@Slf4j
@NotThreadSafe
public class ImmutableExample2 {
    private final static Map<Integer, Integer> map = Maps.newHashMap();

    static {
        map.put(1, 2);
        map.put(3, 4);
        map.put(5, 6);
//        map = Collections.unmodifiableMap(map);
    }

    public static void main(String[] args) {
        map.put(1, 3);
        log.info("{}", map.get(1));
    }

}
